//
//  AppDelegate.m
//  SmallDecisions
//
//  Created by 李付雄 on 2025/6/14.
//

#import "AppDelegate.h"
//#import <IQKeyboardManager.h>
#import "SmallDecisionsBaseTabBarController.h"
#import "SmallDecisionsGoogleAdsHelper.h"
#import "SmallDecisionsIAPHelper.h"

@interface AppDelegate ()

@end

@implementation AppDelegate


- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
    // Override point for customization after application launch.
    
    CGSize mainScreenSize = [UIScreen mainScreen].bounds.size;
    UIWindow *window = [[UIWindow alloc] initWithFrame:CGRectMake(0, 0, mainScreenSize.width, mainScreenSize.height)];
    window.backgroundColor = [UIColor whiteColor];
    [window makeKeyAndVisible];
    self.window = window;
    
    SmallDecisionsBaseTabBarController *mainTabBarController = [[SmallDecisionsBaseTabBarController alloc] init];
    self.window.rootViewController = mainTabBarController;
    
//    [IQKeyboardManager sharedManager].shouldResignOnTouchOutside = YES;
    [SmallDecisionsGoogleAdsHelper startRegisterGoogleMobileAds];
    return YES;
}


- (void)applicationDidBecomeActive:(UIApplication *)application {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{

        [SmallDecisionsGoogleAdsHelper startLoadGoogleLaunchMobileAdsWithController:application.keyWindow.rootViewController failureBlock:nil];
        [SmallDecisionsIAPHelper applePayIAPRestoreProductSuccessBlock:nil failedBlock:nil];
    });
}

- (void)applicationWillEnterForeground:(UIApplication *)application {
    [SmallDecisionsGoogleAdsHelper startLoadGoogleLaunchMobileAdsWithController:application.keyWindow.rootViewController failureBlock:nil];
}



@end
